from datetime import datetime
from packages.common.base_model import db, BaseModel


class VisLog(BaseModel):
    """
    系统访问日志表模型
    """
    __tablename__ = "sys_vis_log"
    __table_args__ = ({"comment": "系统访问日志表", "extend_existing": True})
    name = db.Column(db.String, name="name", unique=False, nullable=True, comment="名称")
    success = db.Column(db.String, name="success", unique=False, nullable=True, comment="是否执行成功（Y-是，N-否）")
    message = db.Column(db.String, name="message", unique=False, nullable=True, comment="具体消息")
    ip = db.Column(db.String, name="ip", unique=False, nullable=True, comment="ip")
    location = db.Column(db.String, name="location", unique=False, nullable=True, comment="地址")
    browser = db.Column(db.String, name="browser", unique=False, nullable=True, comment="浏览器")
    os = db.Column(db.String, name="os", unique=False, nullable=True, comment="操作系统")
    visType = db.Column(db.Integer, name="vis_type", unique=False, nullable=True, comment="操作类型（字典 1登入 2登出）")
    visTime = db.Column(db.DateTime, name="vis_time", unique=False, nullable=True, comment="访问时间", default=datetime.now)
    account = db.Column(db.String, name="account", unique=False, nullable=True, comment="访问账号")
    signValue = db.Column(db.String, name="sign_value", unique=False, nullable=True, comment="签名数据（除ID外）")
    createTime = None
    updateTime = None
    createUser = None
    updateUser = None
    isDeleted = None
